Skip to content

[hotfix][Metrics] Iterate a locked table-runtime snapshot in gauges - #4326

Open
czy006 wants to merge 3 commits into
apache:masterfrom
czy006:codex/hotfix-metrics-gauge-snapshot
Open

[hotfix][Metrics] Iterate a locked table-runtime snapshot in gauges#4326
czy006 wants to merge 3 commits into
apache:masterfrom
czy006:codex/hotfix-metrics-gauge-snapshot

Conversation

@czy006

@czy006 czy006 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Brief change log

Make optimizer-group metric gauges iterate a scheduling-policy snapshot instead of the live runtime map. The snapshot is taken under the policy lock, preventing concurrent modification failures while metrics are scraped.

How was this patch tested?

  • Add snapshot-independence test coverage for scheduling-policy table runtimes.
  • Add screenshots for manual tests if appropriate (not applicable: backend-only change).
  • Run TestSchedulingPolicy locally with JDK 11 before creating this pull request.

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • no
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • not applicable

@github-actions github-actions Bot added the module:ams-server Ams server module label Aug 17, 2026
…p gauges

OptimizerGroupMetrics' five table-count gauges streamed over
SchedulingPolicy's live HashMap on scrape threads without tableLock;
concurrent addTable/removeTable (table onboarding, group migration)
threw ConcurrentModificationException mid-scrape. getTableRuntimeMap()
is @VisibleForTesting yet was the production access path.

Add tableRuntimesSnapshot() (locked copy, same pattern as
tableIdentifiersSnapshot) and point the gauges at it. Churn regression
test: with the lock temporarily removed it fails 2 of 3 runs with CME;
locked it is stable.
Fix record: docs/fix-records/2026-08-16-fix-17-gauge-snapshot-cme.md
@czy006
czy006 force-pushed the codex/hotfix-metrics-gauge-snapshot branch from a2f0d14 to e7c666d Compare August 18, 2026 02:16
czy006 added 2 commits August 28, 2026 10:24
Exercise the registered optimizer-group gauges directly and fail deterministically if they read SchedulingPolicy's live runtime map. This replaces the snapshot-only test that did not cover the production metric path.
@czy006
czy006 marked this pull request as ready for review August 28, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ams-server Ams server module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant